package com.neu.questionnaire_system.controller;


import com.neu.questionnaire_system.beans.ResponseEntity;
import com.neu.questionnaire_system.service.impl.ChoiceServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xingle
 * @since 2022-11-07
 */
@RestController
@RequestMapping("/choice")
@CrossOrigin
public class ChoiceController {
    @Autowired
    private ChoiceServiceImpl choiceService;

    @RequestMapping("/insertChoice")
    public ResponseEntity insertChoice( String toQuestion, String questionId, String choiceText){
        return choiceService.insertChoice(toQuestion,questionId,choiceText);
    }
    @RequestMapping("/selectChoiceByQuestionId")
    public ResponseEntity selectChoiceByQuestionId(String questionId){
        return choiceService.selectChoiceByQuestionId(questionId);
    }
    @RequestMapping("/updateChoice")
    public ResponseEntity updateChoice(String questionId, String toQuestion, String choiceText, String choiceId){
        return choiceService.updateChoice(questionId,toQuestion,choiceText,choiceId);
    }
    @RequestMapping("/deleteChoice")
    public ResponseEntity deleteChoice(String choiceId){
        return choiceService.deleteChoice(choiceId);
    }


}
